package com.example.studyktdemo.uitls

import com.example.studyktdemo.constants.Constants
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class RetrofitManager {
    var retrofitManager: RetrofitManager? = null
    lateinit var retrofit: Retrofit

    fun getInstance(): RetrofitManager? {
        if (retrofitManager == null) {
            synchronized(this) {
                if (retrofitManager == null) {
                    retrofitManager = RetrofitManager()
                }
            }
        }
        return retrofitManager
    }

    fun build() {
        retrofit = Retrofit.Builder()
            .addConverterFactory(GsonConverterFactory.create())
            .baseUrl(Constants.BASE_URL)
            .build()
    }
}